package com.hzz.dao.report;

import com.hzz.framework.dao.IBaseDao;
import com.hzz.framework.entity.IEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>报送任务-信息填报 数据库处理接口类。
 */
@Mapper
public interface IReportTaskSubmitDao extends IBaseDao {

    /**
     * 判断是否存在
     */
    @Override
    @Select("select IFNULL(count(0),0) as count from report_task_submit where  id = #{id} ")
    int isDataExist(IEntity entity) throws Exception;

    /**
     * 逻辑删除
     */
    @Override
    @Update("update report_task_submit set version=version+1, date_updated=now(), del_flag=1 where  id = #{id} ")
    int deleteById(IEntity entity) throws Exception;


    /**
     * 根据主键 物理删除
     */
    @Override
    @Delete("delete from report_task_submit where  id = #{id} ")
    int deleteByPrimaryKey(IEntity entity) throws Exception;


    /**
     * 任务审核
     */
    @Delete("update report_task_submit set date_updated=now(),version=version+1,audit_state=#{auditState},audit_result=#{auditResult},audit_operator_id=#{createId},audit_operator_name=#{auditOperatorName} where id = #{id} and state=1 and audit_state!=1")
    int itemAudit(IEntity entity) throws Exception;

}